package com.yyh.javase1;

public class Test2 {
    public static void main(String[] args) {
        //将10进制的19转为2进制:1001
        String s1 = Integer.toBinaryString(19);
        System.out.println("s1 = " + s1);
        //将10进制的19转为16进制:13
        String s2 = Integer.toHexString(19);
        System.out.println("s2 = " + s2);
        //将10进制的19转为8进制:21
        String s3 = Integer.toOctalString(19);
        System.out.println("s3 = " + s3);
        //其他进制转为10进制
        int num1 = Integer.parseInt("10011", 2);
        System.out.println("num1 = " + num1);
        int num2 = Integer.parseInt("29c", 16);
        System.out.println("num2 = " + num2);
        int num3 = Integer.parseInt("457", 8);
        System.out.println("num3 = " + num3);
    }
}
